package com.example.springcloud.controller;


import com.example.springcloud.DefaultProcess;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

@Component
@EnableBinding(DefaultProcess.class)
public class MessageListener {

    @Value("${server.port}")
    private String serverPort;

    @StreamListener(value = "study_input")
    public void input(Message<String> message) {
        System.out.println("消费者input1号,----->接受到的消息: " + message.getPayload() + "\t  port: " + serverPort);
    }
    @StreamListener(value = "study_input1")
    public void input1(Message<String> message) {
        System.out.println("消费者input2号--study-key1,----->接受到的消息: " + message.getPayload() + "\t  port: " + serverPort);
    }
}
